<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>cocos.collision_model.CollisionManagerGrid</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body>
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar">
  <tr valign="middle">
  <!-- Project homepage -->
      <!--<th class="navbar" 
            ><a class="navbar" target="_top" href="http://www.cocos2d.org/">cocos2d API reference</a></th>-->

  <!-- Tree link -->
      <th><a
        href="module-tree.html">Trees</a></th>

  <!-- Index link -->
      <th><a
        href="identifier-index.html">Indices</a></th>

  <!-- Breadcrumbs -->
      <th class="navbar-breadcrumbs">
        <span class="breadcrumbs">
          <a href="cocos-module.html">cocos</a>&nbsp;.&nbsp;<a href="cocos.collision_model-module.html">collision_model</a>&nbsp;.&nbsp;CollisionManagerGrid
        </span>
      </th>

      <th class="navbar last">
        <a href="javascript:toggleFrames()">Toggle&nbsp;frames</a>
      </th>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class cocos.collision_model.CollisionManagerGrid</h1>
<p>Implements the CollisionManager interface based on the scheme
known as spatial hashing.</p>
<p>The idea behind is to divide the space in rectangles with a given width and
height, and have a table telling which objects overlaps each rectangle.</p>
<p>Later, when the question 'which know objects has such and such spatial
relation with &lt;some object&gt;' arrives, only the objects in rectangles
overlaping &lt;some object&gt; (or nearby ones) needs to be examined for the
condition.</p>
<p>Look at CollisionManager for other class and methods documentation.</p>

<!-- ==================== METHODS ==================== -->
<a name="section-Methods"></a>
        <h2>Methods</h2>
<table class="summary">
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a href="cocos.collision_model.CollisionManagerGrid-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">xmin</span>,
        <span class="summary-sig-arg">xmax</span>,
        <span class="summary-sig-arg">ymin</span>,
        <span class="summary-sig-arg">ymax</span>,
        <span class="summary-sig-arg">cell_width</span>,
        <span class="summary-sig-arg">cell_height</span>)</span>
<div class="summary-description">Cell width and height have impact on performance.</div>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="add"></a><span class="summary-sig-name">add</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="remove_tricky"></a><span class="summary-sig-name">remove_tricky</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="clear"></a><span class="summary-sig-name">clear</span>(<span class="summary-sig-arg">self</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="they_collide"></a><span class="summary-sig-name">they_collide</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj1</span>,
        <span class="summary-sig-arg">obj2</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="objs_colliding"></a><span class="summary-sig-name">objs_colliding</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="iter_colliding"></a><span class="summary-sig-name">iter_colliding</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="any_near"></a><span class="summary-sig-name">any_near</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>,
        <span class="summary-sig-arg">near_distance</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="objs_near"></a><span class="summary-sig-name">objs_near</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>,
        <span class="summary-sig-arg">near_distance</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="objs_near_wdistance"></a><span class="summary-sig-name">objs_near_wdistance</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>,
        <span class="summary-sig-arg">near_distance</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="ranked_objs_near"></a><span class="summary-sig-name">ranked_objs_near</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>,
        <span class="summary-sig-arg">near_distance</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="iter_all_collisions"></a><span class="summary-sig-name">iter_all_collisions</span>(<span class="summary-sig-arg">self</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="knows"></a><span class="summary-sig-name">knows</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">obj</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="known_objs"></a><span class="summary-sig-name">known_objs</span>(<span class="summary-sig-arg">self</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="objs_touching_point"></a><span class="summary-sig-name">objs_touching_point</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">x</span>,
        <span class="summary-sig-arg">y</span>)</span>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <span class="summary-sig"><a name="objs_into_box"></a><span class="summary-sig-name">objs_into_box</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">minx</span>,
        <span class="summary-sig-arg">maxx</span>,
        <span class="summary-sig-arg">miny</span>,
        <span class="summary-sig-arg">maxy</span>)</span>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
        <h2>Method Details</h2>
<table class="details">
</table>
<a name="__init__"></a>
<div class=" detail">
  <h3>__init__</h3>
  <div class="detail-signature">
    <span class="fspecial">(Constructor)</span>
    <span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">xmin</span>,
        <span class="sig-arg">xmax</span>,
        <span class="sig-arg">ymin</span>,
        <span class="sig-arg">ymax</span>,
        <span class="sig-arg">cell_width</span>,
        <span class="sig-arg">cell_height</span>)</span>
    </div>
  <div class="detail-description">
  Cell width and height have impact on performance.
For objects with same with, and with width==height, a good value
is 1.25 * (object width).
For mixed widths, a good guess can be
~ 1.25 * { width(object): all objects not exceptionlly big}
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><dl class="parameters">
        <dt><span class="pname">xmin</span> : <span class='ptype'>float</span></dt>
        <dd>minimun x coordinate for a point in world</dd>
        <dt><span class="pname">xmax</span> : <span class='ptype'>float</span></dt>
        <dd>maximun x coordinate for a point in world</dd>
        <dt><span class="pname">ymin</span> : <span class='ptype'>float</span></dt>
        <dd>minimun y coordinate for a point in world</dd>
        <dt><span class="pname">ymax</span> : <span class='ptype'>float</span></dt>
        <dd>maximun y coordinate for a point in world</dd>
        <dt><span class="pname">cell_width</span> : <span class='ptype'>float</span></dt>
        <dd>width for the rectangles the space will be broken</dd>
        <dt><span class="pname">cell_height</span> : <span class='ptype'>float</span></dt>
        <dd>heigh for the rectangles the space will be broken</dd>
    </dl></dd>
  </dl>
  </div>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar">
  <tr valign="middle">
  <!-- Project homepage -->
      <!--<th class="navbar" 
            ><a class="navbar" target="_top" href="http://www.cocos2d.org/">cocos2d API reference</a></th>-->

  <!-- Tree link -->
      <th><a
        href="module-tree.html">Trees</a></th>

  <!-- Index link -->
      <th><a
        href="identifier-index.html">Indices</a></th>

  <!-- Breadcrumbs -->
      <th class="navbar-breadcrumbs">
        <span class="breadcrumbs">
          <a href="cocos-module.html">cocos</a>&nbsp;.&nbsp;<a href="cocos.collision_model-module.html">collision_model</a>&nbsp;.&nbsp;CollisionManagerGrid
        </span>
      </th>

      <th class="navbar last">
        <a href="javascript:toggleFrames()">Toggle&nbsp;frames</a>
      </th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Wed Oct 26 10:00:13 2011
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
